﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BotonJXC.Entity;
using BotonJXC.Util;
using NHibernate.Criterion;

namespace BotonJXC.DAO
{
   public class FinanceBillLogsDao : NHibernateDao<FinanceBillsLogs, int>
    {

        /// <summary>
        /// 
        /// </summary>
        /// <param name="orderSn"></param>
        /// <returns></returns>
       public IList<FinanceBillsLogs> findFinanceBillsLogsBySn(string BillSn, string BillType)
        {
            List<ICriterion> criterions = new List<ICriterion>();
            if (Utils.IsNotBlank(BillSn))
            {
                criterions.Add(Restrictions.Eq("BillSn", BillSn));
            }
           if (Utils.IsNotBlank(BillType))
            {
                criterions.Add(Restrictions.Eq("BillType", BillType));
            }
            return base.Find(criterions.ToArray());
        }
       /// <summary>
       /// 
       /// </summary>
       /// <param name="orderSn"></param>
       /// <returns></returns>
       public IList<FinanceBillsLogs> findFinanceBillsLogsBySn(string BillSn, string BillType, Int32 BillSign)
       {
           List<ICriterion> criterions = new List<ICriterion>();
           if (Utils.IsNotBlank(BillSn))
           {
               criterions.Add(Restrictions.Eq("BillSn", BillSn));
           }
           if (Utils.IsNotBlank(BillType))
           {
               criterions.Add(Restrictions.Eq("BillType", BillType));
           }
           Int32 [] names = { 2,  4};
           criterions.Add(Restrictions.In("BillSign", names));
           
           return base.Find(criterions.ToArray());
       }
    }
}
